/*
	QUBE
	Sandra Obermann - QPT 1 - 2012
	fhs33730 - 1110601021
	FH Salzburg - Studiengang MultiMediaTechnolgy
*/

#ifndef DATAMANAGER_H_INCLUDED
#define DATAMANAGER_H_INCLUDED

// Cinder Includes
#include "cinder/app/AppBasic.h"
#include "cinder/Camera.h"

// Own written Includes
#include "../include/BLOCK.h"
#include "../include/Level.h"
#include "../include/FontDisplay.h"
#include "../include/QubeTimer.h"
#include "../include/Qube.h"
#include "../include/Background.h"

// My DataManager Class
class DataManager
{
public:

	static DataManager* getInstance();
	void releaseInstance();

	// setup all data
	void			initFonts();

	// QUBE Game Methods
	void			addQubeColor( ci::Color color );

	// Colors
	unsigned int	getQubeColorsSize() const;
	ci::Color		getQubeColor( unsigned int index ) const;

	// QTimer
	float			getMaxTimeToChangeQubeColor() const;

	// Level design
	void			buildLevel();
	void			killLevel();
	void			drawLevel();
	BLOCK*			getLevelBlock( int x, int y, int z );
	// Initialize Finish Platform and check if QUBE reached the Finish
	void			isFinishedLevel();

	// FontDisplay
	void			drawFont(E_FONT_ID _fontendID);

	// Timing
	QubeTimer*		getTimer();
	
	// Qube
	QUBE*			getQube();
	void			setupQube();
	void			drawQube();
	void			updateQube();

	// Game events
	void			moveQubeToDir( QUBE_MOVEMENT dir );
	void			setGameOver(bool flag);
	void			setGameFinished(bool flag);
	bool			isGameOver();
	bool			isGameFinished();
	void			resetGame();

	// Camera
	void			setupCamera();
	void			updateCamera();
	void			resizeCamera(ResizeEvent event);
	CameraPersp		getCameraPersp();

	// Background
	void drawBackground();

private:

	//Default DataManager Constructor/Destructor
	DataManager();
	~DataManager();

	static DataManager*			m_Instance;
	
	// Level
	Level*						m_level;
	FontDisplay*				m_fonts;
	QubeTimer*					m_timer;

	// QUBE Color Properties
	float						m_MaxTimeToChangeQubeColor;
	std::vector<ci::Color>		m_QubeColors;

	// Qube
	QUBE*						m_Qube;

	// Game Variables
	bool					m_finished;
	bool					m_gameOver;

	// Camera Variables
	CameraPersp				m_cameraPerspective;
	Vec3f					m_currentCameraPosition;

	// Background
	Background*				m_background;
};

#endif // DATAMANAGER_H_INCLUDED